package com.nyist.myticket.core.base;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * @author yangxiaogen
 * @date 2020/12/30 18:51
 */
@Data
public abstract class BaseEntity<T extends BaseEntity<?>> extends Model<T> implements Serializable {

    private static final long serialVersionUID = 2049409488631452486L;

    public static final int DEFAULT_PAGE = -1;

    @TableId(value = "id" , type = IdType.AUTO)
    @TableField(exist = false)
    private String id;

    @TableField(exist = false)

    @ApiModelProperty(value = "任务状态，0：启动，1：暂停，2：停用")
    private String status = "0";


    @ApiModelProperty(value = "任务状态，0：启动，1：暂停，2：停用")
    @TableField(exist = false)
    private String statusName;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private Date createTime;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField(exist = false,value = "last_modified",fill = FieldFill.UPDATE)
    private Date lastModified;

    // 分页页数
    @TableField(exist = false)
    private int page = DEFAULT_PAGE;
    // 行数
    @TableField(exist = false)
    private int row;
    //页数
    @TableField(exist = false)
    private int records;
    // 总记录数
    @TableField(exist = false)
    private int total;
}
